package com.tensquare.qa.dao;

import com.tensquare.qa.pojo.Problem;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

/**
 * Created by WF on 2020/3/30 15:46
 */
public interface QaDao extends JpaRepository<Problem,String> {
    //1.查询最新问题列表
    @Query(nativeQuery = true,value="select * from tb_problem p,tb_pl where id=problemid and labelid=?1 order by createtime desc")
    Page<Problem> findProblemsByLabelid(String labelid, Pageable pageable);
    //2.查询热门问题
    @Query(nativeQuery = true,value="select * from tb_problem p,tb_pl where id=problemid and labelid=?1 order by reply desc")
    Page<Problem> findHotListByLabelId(String labelid, Pageable pageable);
}
